package com.iwayin.core.dao.category;

import java.util.List;

import com.iwayin.core.dao.BaseDAOImpl;
import com.iwayin.core.dataobject.CategoryDO;

public class CategoryDAOImpl extends BaseDAOImpl implements CategoryDAO {

	@Override
	public List<CategoryDO> listCategory() {
		return queryForList("CategoryDAO.listCategory", null);
	}

	@Override
	public CategoryDO getCategoryById(Long id) {
		return (CategoryDO) queryForObject("CategoryDAO.getCategory", id);
	}
	
	@Override
	public CategoryDO findCategoryByName(String categoryName) {
		return (CategoryDO) this.getSqlMapClientTemplate().queryForObject("CategoryDAO.findCategoryByName", categoryName);
	}

	@Override
	public Long addCategory(CategoryDO tempCategory) {
		return (Long) this.getSqlMapClientTemplate().insert("CategoryDAO.addCategory",tempCategory);
	}

}
